package com.kexio.common.constant;

/**
 * 系统常量
 * 
 * @author Kexio Team
 * @since 1.0.0
 */
public final class SystemConstants {
    
    private SystemConstants() {
        throw new UnsupportedOperationException("This is a constants class and cannot be instantiated");
    }
    
    // ==================== 系统信息 ====================
    
    /**
     * 系统名称
     */
    public static final String SYSTEM_NAME = "Kexio";
    
    /**
     * 系统版本
     */
    public static final String SYSTEM_VERSION = "1.0.0";
    
    /**
     * 系统编码
     */
    public static final String DEFAULT_CHARSET = "UTF-8";
    
    // ==================== 用户相关 ====================
    
    /**
     * 超级管理员用户名
     */
    public static final String SUPER_ADMIN = "admin";
    
    /**
     * 匿名用户
     */
    public static final String ANONYMOUS_USER = "anonymous";
    
    /**
     * 系统用户
     */
    public static final String SYSTEM_USER = "system";
    
    // ==================== 状态码 ====================
    
    /**
     * 启用状态
     */
    public static final Integer STATUS_ENABLED = 1;
    
    /**
     * 禁用状态
     */
    public static final Integer STATUS_DISABLED = 0;
    
    /**
     * 删除标记 - 未删除
     */
    public static final Integer NOT_DELETED = 0;
    
    /**
     * 删除标记 - 已删除
     */
    public static final Integer DELETED = 1;
    
    // ==================== 缓存相关 ====================
    
    /**
     * 默认缓存过期时间(秒) - 30分钟
     */
    public static final int DEFAULT_CACHE_TTL = 1800;
    
    /**
     * 短期缓存过期时间(秒) - 5分钟
     */
    public static final int SHORT_CACHE_TTL = 300;
    
    /**
     * 长期缓存过期时间(秒) - 24小时
     */
    public static final int LONG_CACHE_TTL = 86400;
    
    // ==================== 安全相关 ====================
    
    /**
     * JWT令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";
    
    /**
     * 令牌请求头名称
     */
    public static final String TOKEN_HEADER = "Authorization";
    
    /**
     * 刷新令牌请求头名称
     */
    public static final String REFRESH_TOKEN_HEADER = "X-Refresh-Token";
    
    /**
     * 租户ID请求头名称
     */
    public static final String TENANT_HEADER = "X-Tenant-Id";
    
    /**
     * 用户代理请求头名称
     */
    public static final String USER_AGENT_HEADER = "User-Agent";
    
    /**
     * 客户端IP请求头名称
     */
    public static final String CLIENT_IP_HEADER = "X-Real-IP";
    
    // ==================== 业务相关 ====================
    
    /**
     * 根节点ID
     */
    public static final Long ROOT_NODE_ID = 0L;
    
    /**
     * 默认排序值
     */
    public static final Integer DEFAULT_SORT = 0;
    
    /**
     * 顶级菜单的父ID
     */
    public static final Long TOP_MENU_PARENT_ID = 0L;
    
    /**
     * 默认头像
     */
    public static final String DEFAULT_AVATAR = "/static/images/default-avatar.png";
    
    // ==================== 数据库相关 ====================
    
    /**
     * 主数据源名称
     */
    public static final String MASTER_DATASOURCE = "master";
    
    /**
     * 从数据源名称
     */
    public static final String SLAVE_DATASOURCE = "slave";
    
    /**
     * 批处理大小
     */
    public static final int BATCH_SIZE = 1000;
    
    // ==================== 文件相关 ====================
    
    /**
     * 默认文件上传路径
     */
    public static final String DEFAULT_UPLOAD_PATH = "/uploads";
    
    /**
     * 最大文件大小 (10MB)
     */
    public static final long MAX_FILE_SIZE = 10 * 1024 * 1024;
    
    /**
     * 允许的图片格式
     */
    public static final String[] ALLOWED_IMAGE_FORMATS = {"jpg", "jpeg", "png", "gif", "bmp", "webp"};
    
    /**
     * 允许的文档格式
     */
    public static final String[] ALLOWED_DOCUMENT_FORMATS = {"pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt"};
    
    // ==================== 消息相关 ====================
    
    /**
     * 默认队列名称
     */
    public static final String DEFAULT_QUEUE = "kexio.default.queue";
    
    /**
     * 延迟队列名称
     */
    public static final String DELAY_QUEUE = "kexio.delay.queue";
    
    /**
     * 死信队列名称
     */
    public static final String DEAD_LETTER_QUEUE = "kexio.dlq";
    
    // ==================== 正则表达式 ====================
    
    /**
     * 邮箱格式正则
     */
    public static final String EMAIL_PATTERN = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
    
    /**
     * 手机号格式正则
     */
    public static final String PHONE_PATTERN = "^1[3-9]\\d{9}$";
    
    /**
     * 用户名格式正则 (4-20位，字母数字下划线)
     */
    public static final String USERNAME_PATTERN = "^[a-zA-Z0-9_]{4,20}$";
    
    /**
     * 密码格式正则 (8-20位，至少包含字母和数字)
     */
    public static final String PASSWORD_PATTERN = "^(?=.*[a-zA-Z])(?=.*\\d)[a-zA-Z\\d@$!%*?&]{8,20}$";
}
